//
//  UIView+Scale.h
//  TestPerfectScale
//
//  Created by apple on 2016/12/14.
//  Copyright © 2016年 Apple. All rights reserved.
//

#import <UIKit/UIKit.h>

#define Fit(num) (getScreenScale(num))

static inline CGFloat getScreenScale(CGFloat num) {
    static CGFloat scale;
    if (!scale) { scale = CGRectGetWidth([UIScreen mainScreen].bounds) / 375.0; } return scale == 1.0 ? num : scale * num;
}

@interface UILabel (AdaptivePerfect)
///  字体大小（会自动适配屏幕）
@property (nonatomic, assign) IBInspectable CGFloat rm_font;
/// 设置字体大小（会自动适配屏幕）
/// @param rm_font 大小
/// @param weight nomal\medium\...
- (void)setRm_font:(CGFloat)rm_font size:(UIFontWeight)weight;
@end

@interface UIButton (AdaptivePerfect)
///  字体大小（会自动适配屏幕）
@property (nonatomic, assign) IBInspectable CGFloat rm_font;
/// 设置字体大小（会自动适配屏幕）
/// @param rm_font 大小
/// @param weight nomal\medium\...
- (void)setRm_font:(CGFloat)rm_font size:(UIFontWeight)weight;
@end

@interface UITextField (AdaptivePerfect)
///  字体大小（会自动适配屏幕）
@property (nonatomic, assign) IBInspectable CGFloat rm_font;
/// 设置字体大小（会自动适配屏幕）
/// @param rm_font 大小
/// @param weight nomal\medium\...
- (void)setRm_font:(CGFloat)rm_font size:(UIFontWeight)weight;
@end

@interface UITextView (AdaptivePerfect)
///  字体大小（会自动适配屏幕）
@property (nonatomic, assign) IBInspectable CGFloat rm_font;
/// 设置字体大小（会自动适配屏幕）
/// @param rm_font 大小
/// @param weight nomal\medium\...
- (void)setRm_font:(CGFloat)rm_font size:(UIFontWeight)weight;
@end


@interface UIView (AdaptivePerfect)

@property (nonatomic, assign) IBInspectable CGFloat rm_cornerRadius;
/// 遍历所有子控件，让所以的约束 * 比例
- (void)rm_fitAllConstraint;

@end
